package com.gnerv.battle.boot.project.guard.model.bo;

import com.gnerv.battle.boot.common.tools.DateTimeTools;
import com.gnerv.battle.boot.project.guard.model.entity.MonitorMiddleware;
import lombok.Data;
import org.springframework.beans.BeanUtils;

@Data
public class MonitorMiddlewareBO {

    private String ukId;
    private String name;
    private String type;
    private String version;
    private String arguments;
    private String template;
    private String status;
    private Integer sort;

    public MonitorMiddleware toCreateMonitorMiddleware() {
        MonitorMiddleware monitorMiddleware = new MonitorMiddleware();
        BeanUtils.copyProperties(this, monitorMiddleware);
        monitorMiddleware.setGmtCreate(DateTimeTools.currentTimeMillis());
        monitorMiddleware.setGmtModified(DateTimeTools.currentTimeMillis());
        return monitorMiddleware;
    }

    public MonitorMiddleware toUpdateMonitorMiddleware() {
        MonitorMiddleware monitorMiddleware = new MonitorMiddleware();
        BeanUtils.copyProperties(this, monitorMiddleware);
        monitorMiddleware.setGmtModified(DateTimeTools.currentTimeMillis());
        return monitorMiddleware;
    }

}

